package com.ant.myagile



import grails.test.mixin.*

import org.junit.*

import com.ant.myagile.backlog.Sprint

/**
 * See the API for {@link grails.test.mixin.services.ServiceUnitTestMixin} for usage instructions
 */
@TestFor(MeetingVideoService)
@Mock([Member, Team, Sprint, MeetingVideo])
class MeetingVideoServiceTests {

	void setUp() {
		Member.metaClass.encodePassword = { -> }
		def sebi = new Member(username: "sebastian.sussmann@axonactive.vn", password: "123456", enabled: true,
		firstName: "Sebastian", lastName: "Sussmann", gender: "Male", company: "Axon Active Vietnam", isActive: true,
		skype: "sebastian.sussmann.home", position: "Chief Information Manager", avatar: "15.jpg", mobile: "01239911602")
		sebi.save(failOnError: true);
		

		Team knight = new Team(teamName: "Knight", mailGroup: "knight@axonactive.vn", establishedDate: new Date().parse("yy-MM-dd", "2013-06-07"), owner: sebi, logo: "knight.jpg").save(failOnError: true)
		Sprint knightSp1 = new Sprint(sprintName: "Sprint-1", status: "open", dateStart: new Date().parse("yy-MM-dd", "2013-07-05"), dateEnd: new Date().parse("yy-MM-dd", "2013-08-23"), team: knight).save(failOnError: true)

		MeetingVideo mv1knightSp1 = new MeetingVideo(videoFileName: "demo1.mp4", meetingDate: new Date().parse("yy-MM-dd", "2013-07-05"), sprint : knightSp1).save(failOnError: true);
	}

	void testFindVideoBySprint() {
		def sprint = Sprint.get(1);
		assertEquals(1, sprint.meetingVideos.size());
	}

	void tearDown() {
	
	}
}
